home *** CD-ROM | disk | FTP | other *** search
- /*
- File: DTS_SCSI_IO.h
-
-
-
-
- Unfortunately, no matter how long awaited, it's still not done. In fact, this
- isn't even a release- this is just an image of the code taken in the middle of
- development.
-
- THIS CODE DOES NOT WORK AS A WHOLE. MUCH OF IT IS BUGGY AND / OR INCOMPLETE.
- YOU WOULD HAVE TO BE ABSOLUTELY INSANE TO USE ANY OF THIS CODE IN YOUR
- PROJECT WITHOUT EXTENSIVE THOUGHT, DEBUGGING AND TESTING.
-
-
-
-
-
-
- Contains: Interface to our low-level SCSI routines, SCSIOp and SCSIPrime.
-
- Written by: Mike Bell, Neil Day, Colleen Delgadillo, Tim Dierks, Dennis
- Hescox, Craig Prouse, Kent Sandvik, Bryan Stearns
-
- Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- 3/14/92 BJS xxx put comment here xxx
-
- To Do:
- */
-
- #ifndef __DTS_SCSI_IO__
- #define __DTS_SCSI_IO__
-
- #ifndef __SCSI__
- #include <SCSI.h>
- #endif
-
- // SCSI command bytes. There are others, but these are the ones we use.
- #define SCSICmd_TestUnitReady 0x00
- #define SCSICmd_Format 0x04
- #define SCSICmd_Read 0x08
- #define SCSICmd_Write 0x0A
- #define SCSICmd_Inquiry 0x12
- #define SCSICmd_ReadCap 0x25
-
- // a SCSI address, 0-7 (except that 7 is the host Macintosh!)
- typedef short SCSIAddress;
-
- // A six-byte SCSI Command Block
- typedef unsigned char SCSICommandBlock[6];
-
- // A TransferInstructionBlock, a sequence of SCSIInstructions
- typedef SCSIInstr TransferInstructionBlock[];
-
- // Handy shorthand for parameters to SCSIOp
- #define kDoWrite true
- #define kDoRead false
- #define kDoBlind true
- #define kDoPolled false
- #define kHoldIt true
- #define kUnholdIt false
- #define kIgnored false
- #define kNoBuffer NULL, 0, 0, kIgnored, kIgnored
- #define kNoLoop 0
-
- // Timeouts (in ticks) for different kinds of SCSI operations
- #define kIOTimeout (60 * 60) /* a full minute for I/O operations */
- #define kFormatTimeout (60 * 60 * 60) /* an hour for formatting */
- #define kShortTimeout (1 * 60) /* one second for commands that we know are easy */
-
- //
- // Function Prototypes
- //
-
- // If calling the low-level code from an application, you have to hold
- // yourself and call this routine twice to hold the low-level SCSI code:
- // once before the SCSI operation with holdIt=true, and once after with
- // holdIt = false.
- extern OSErr HoldLowLevelCode(Boolean holdIt);
-
- // Fill in a SCSI Command Block
- extern void StuffSCSICommandBlock(SCSICommandBlock cmd, unsigned char a, unsigned char b,
- unsigned char c, unsigned char d, unsigned char e, unsigned char f);
-
- // Fill in a Transfer Instruction Block
- extern void StuffTransferInstructionBlock(TransferInstructionBlock tib, void *buffer, unsigned
- long blockSize, unsigned long loopCount);
-
- // Perform a SCSI operation
- extern OSErr SCSIOp(SCSICommandBlock cmd, short cmdSize, short targetSCSIID, unsigned long
- completionTimeout, void *buffer, unsigned long blockSize,
- unsigned long loopCount, Boolean writing, Boolean blind);
-
- // Perform a SCSI blockread or write
- extern OSErr SCSIPrime(void *dataStart, short targetSCSIID, short targetUnit, unsigned long
- startBlock, unsigned long *blockCountPtr, unsigned long blockSize, Boolean
- writing, Boolean blind, unsigned long completionTimeout);
-
- #endif
-